package com.esd.csair;

import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.log4j.Logger;

import com.gargoylesoftware.htmlunit.ScriptException;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptErrorListener;

public class JavaScriptErrorListenerEx implements JavaScriptErrorListener ,Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6271067504502386121L;
	private static Logger log = Logger.getLogger(JavaScriptErrorListenerEx.class);

	
	public JavaScriptErrorListenerEx() {
		
	}
	
	@Override
	public void scriptException(HtmlPage page, ScriptException scriptException) {
		log.info("**************scriptException************************");
		log.info(page.getUrl());
		log.info(scriptException);
		log.info("**************scriptException************************");
	}

	@Override
	public void timeoutError(HtmlPage page, long allowedTime, long executionTime) {
		log.info("**************timeoutError************************");
		log.info(page.getUrl());
		log.info(allowedTime);
		log.info(executionTime);
		log.info("**************timeoutError************************");
	}

	@Override
	public void malformedScriptURL(HtmlPage page, String url, MalformedURLException malformedURLException) {
		log.info("**************malformedScriptURL************************");
		log.info(url);
		log.info(malformedURLException);
		log.info("**************malformedScriptURL************************");

	}

	@Override
	public void loadScriptError(HtmlPage page, URL scriptUrl, Exception exception) {
		log.info("**************loadScriptError************************");
		log.info(scriptUrl);
		log.info(exception);
		log.info("**************loadScriptError************************");

	}

}
